package com.lib.online.dao;

import java.util.List;

import org.hibernate.Session;

import com.lib.online.model.*;

/**
 * Main interface to work with model
 * @author ievgen_s
 * 
 */

public interface LibDAO {

    public Session getSession();
    
    /**
     * Adds user to data set
     * @param user
     * User entity to add
     */
    void addUser(User user);
    
    /**Removes user account
     * @param user
     * User entity to remove
     */
    public void removeUser(User user);
    
    /**
     * Gets one user from data set
     * @param uName
     * First name of user
     * @param password
     * user password
     * @return
     * User entity
     */
    public User getUser(String uName, String password);

    /**
     * Adds a book to user collection
     * @param title
     * Title of the book
     * @param user
     * User entity
     */
    public void addUBook(String title, User user);
    
    /**
     * Removes a book from user collection
     * @param title
     * Title of the book
     * @param user
     * User entity
     */
    public void removeUBook(String title, User user);

    /**
     * Gets all books from specified user`s collection
     * @param user
     * User entity
     * @return
     * List of user`s books
     */
    public List<Reading> getUBooks(User user);
    
    /**
     * Adds book to data set
     * @param book
     * Book entity to add
     */
    public void addBook(Reading book);
    
    /**
     * Removes books from data set
     * @param title
     * Title of the book to remove
     */
    public void removeBook(String title);    
    
    /**
     * Get specified book from data set
     * @param title
     * Title of the book
     * @return
     * Book entity
     */
    public Reading getBook(String title);

    /**
     * Gets all available books from data set
     * @return
     * List of all books
     */
    public List<Reading> getAllBooks();  
        
    /**
     * Gets all authors    
     * @return
     * List of authors
     */
    public List<Author> getAuthors();
    
    /**
     * Gets all users who read this book
     * @param title
     * Title of the book
     * @return
     * List of users
     */
    public List<User> getReaders(String title);

}